package org.example.service;


import org.example.mapper.ArticleMapper;
import org.example.model.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    public List<Article> list(Article a) {
        return articleMapper.selectByCondition(a);//有字段就条件查询，没有字段就非条件查询
    }

    public Article selectById(Integer id) {
        return articleMapper.selectByPrimaryKey(id);
    }

    public int insert(Article a) {
        return articleMapper.insert(a);
    }
}
